import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
// https://vitejs.dev/config/
export default defineConfig({
  base: './',
  build: {
    outDir: 'magic-new-tab-admin-dist'
  },
  resolve: {
    alias: [{ find: '@', replacement: '/src' }],
  },
  server: {
    proxy: {
      '/api': {
        // target: 'http://localhost:3000',
        target: 'http://124.221.183.172:3000',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      },
      '/uploads': {
        // target: 'http://localhost:3000',
        target: 'http://124.221.183.172:3000',
        changeOrigin: true,
      },
    }
  },
  plugins: [react()],
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
        // additionalData: `@import "${resolve(__dirname, '/node_modules/magic-ui-react/globalLess')}";`
      },
    }
  },
});
